@Service
public class EmailService {
    private final TemplateEngine templateEngine;
    private final JavaMailSender javaMailSender;
    @Value("${spring.mail.username}")
    private String from;
    // ...
    public void sendConfirmation(String username, String to, String code)
            throws MessagingException {
        // ...
        javaMailSender.send(mimeMessage);
    }
}
